package field

import "gitee.com/yanwc/net/utils"

type (
	Magic    U2    // 消息头魔术
	MagicRaw U2Raw // 消息头魔术
)

func (m Magic) Raw() (out MagicRaw) {
	copy(out[:], utils.NumberToBytesWithBigEndian(m))
	return
}

func (m MagicRaw) Type() Magic {
	return utils.BytesToNumber[Magic](m[:])
}

func (m MagicRaw) Slice() []byte {
	return m[:]
}
